{extend name="layout" /}


{block name="title"}
<title>导航配置 - thinkPHP极速后台开发</title>
<meta name="title" content="导航配置 - menu - thinkPHP极速后台开发">
<meta name="keywords" content="导航配置,menu配置,php,后台开发包，thinkphp、easyadmin、admin,easy,thinkeasyadmin">
<meta name="description" content="设置项目导航,实现页面间的链接;easyadmin灵活可定制的thinkphp的后台开发工具包,助你快速开发后台">
{/block}

{block name="main"}


<fieldset id="join" class="layui-elem-field">
    <legend>导航</legend>
    <div class="layui-field-box">
        <p>创建一个<code>Admin</code>类 , 实现<code>configMenu</code>方法 , 其他页面类继承<code>Admin</code>类即可</p>
        <pre class="php">
#project\app\admin\controller\Admin.php

namespace app\admin\controller;


use easyadmin\app\libs\Menu;
use easyadmin\app\libs\MenuItem;

class Admin extends \easyadmin\controller\Admin
{
    public function configMenu(Menu $menu)
    {
        $menu->setItems([
            MenuItem::addItem('默认展开', 'http://www.baidu.com', ['class' => 'testclass'])
                ->setChildren([
                    MenuItem::addItem('选项一', 'http://www.wansh.cc'),
                    MenuItem::addItem('选项二', 'lists')
                ]),

            MenuItem::addItem('查看详情', 'show', [
                'params' => [
                    'id' => 7
                ]
            ]),

            MenuItem::addItem('默认收起', 'javascript:')
                ->setChildren([
                    MenuItem::addItem('选项一', 'javascript:'),
                    MenuItem::addItem('选项二', 'show', [
                        'params' => [
                            'id' => 5
                        ]
                    ])
                ])
        ]);

        // $menu->setTemplate('test:test1');
    }

}

</pre>

        <fieldset class="layui-elem-field layui-field-title" id="text">
            <legend>addItem 方法参数说明</legend>
            <div class="layui-field-box">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>字段</th>
                        <th>类型</th>
                        <th>说明</th>
                        <th>必填</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>name</td>
                        <td>string</td>
                        <td>导航名称</td>
                        <td>是</td>
                    </tr>
                    <tr>
                        <td>url</td>
                        <td>string</td>
                        <td>跳转URL</td>
                        <td>是</td>
                    </tr>
                    <tr>
                        <td>options</td>
                        <td>array</td>
                        <td>属性</td>
                        <td>否</td>
                    </tr>
                    <tr>
                        <td>options.class</td>
                        <td>string</td>
                        <td>按钮样式</td>
                        <td>否</td>
                    </tr>
                    <tr>
                        <td>options.icon</td>
                        <td>string</td>
                        <td>按钮图标</td>
                        <td>否</td>
                    </tr>
                    <tr>
                        <td>options.attr</td>
                        <td>string</td>
                        <td>按钮属性</td>
                        <td>否</td>
                    </tr>
                    <tr>
                        <td>options.params</td>
                        <td>array</td>
                        <td>按钮链接的额外属性</td>
                        <td>否</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </fieldset>

    </div>
</fieldset>



{/block}
